DIM SHARED num(10) AS STRING, a(4) AS STRING, f(10) AS INTEGER, t(10) AS INTEGER, tb(6, 5) AS INTEGER, dimx(4) AS INTEGER, dimy(4) AS INTEGER, posx(10) AS INTEGER, posy(10) AS INTEGER, cs AS STRING * 4, sol(4) AS STRING, mov AS INTEGER
DATA 1,1,0,0,0,1,1,0
DATA 4,1,1,4,3,1,2,5,1,1,1,2,3,3,2,2,5,2,2,5,3,4,1,4,4,3,4,2,5,4
DATA u2e2r2f2d7g2l2h2u8
DATA e4d12nr4nl4
DATA u2e2r4f2d2g8r8
DATA u2e2r4f2d2g2nl2f2d2g2l4h2
DATA ne6d4r4nu4nr4d6nr2l2
DATA u4nr8d6r6f2d2g2l6
DATA d2r6f2d2g2l4h2u8e2r4f2
DATA bu4r8d2g4nr2nl2g2d4
DATA f2r4f2d2g2l4h2u2e2h2u2e2r4f2d2g2
DATA bf2br4l6h2u2e2r4f2d8g2l4h2
REM **- Solución -**
DATA "74019352643223646134342263633133515174720404223233530101717124943232626253030213"
DATA "13412424646431345252030173731204047174515133326363127274546161313113937272020254"
DATA "34311191737383832204049494718323029474748123237274930174242482123233534301017171"
DATA "2494148432326262534373719114144273730303911121848434346264525273037203416164"
IF tb(x0 - i * p12, y0 - i * p34) = 1 THEN x = 1: BEEP: EXIT FOR
NEXT i
END SELECT
LOOP UNTIL x = 0
END SUB
SUB figuras
a(2) = "d2r2u2l2" ' Cuadrado pequeño
a(1) = "d4r4u4l4" ' Cuadrado grande
a(3) = "d4r2u4l2 " ' Rectangulo horizontal
a(4) = "d2r4u2l4" ' Rectangulo vertical
FOR i = 0 TO 6: FOR j = 0 TO 5: tb(i, j) = 1: NEXT j, i' Posiciones ocupadas o
tb(4, 2) = 0: tb(4, 3) = 0 ' libres segun 1/0
FOR i = 1 TO 4: READ dimx(i), dimy(i): NEXT i ' Campo de comprobacion
FOR i = 1 TO 10: READ t(i), posx(i), posy(i): NEXT i ' de los movimientos
FOR i = 1 TO 10: READ num(i): NEXT i 'Número de cada figura
FOR i = 24 TO 27: cs = cs + CHR$(i): NEXT i 'Crea el cursor grafico
FOR i = 0 TO 4: READ sol(i): NEXT i 'Solucion codificada
mov = 0 'Movimientos hasta ahora
END SUB
SUB inicio
SCREEN 12
CLS
pantalla
FOR i = 55 TO 202 STEP 4: LINE (358, 358 - i)-(303 + i, 303): NEXT i
FOR i = 203 TO 349 STEP 4: LINE (503, 503 - i)-(156 + i, 156): NEXT i
LOCATE 3, 2: PRINT "Este juego consiste en desplazar el cuadrado grande (3) a la posicion señalada ("; CHR$(176); ") deslizando para ello todos los bloques que sean necesario."
LOCATE 25, 2: PRINT "* Utiliza los cursores y los números asociados a las figuras para ello."
LOCATE 26, 2: PRINT " -> Si quieres salir , pulsa la opción 'f'."
LOCATE 27, 2: PRINT " -> Si quieres ver una solución ( en movimiento ) pulsa 'S'."
LOCATE 28, 2: PRINT "Pulsa cualquier tecla para continuar...";